<template>
	<MkDrawer ref="mkDrawerRef" @submit="submitFn" v-model:isEdit="ctx.isEdit">
		<MkCardForm>
			<MkInput v-model="formValue.name" label="检验名称" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.projectCode" label="项目代码" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.textCode" label="检验代码" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.referenceRange" label="参考范围" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.upperLimit" label="合法上限公式" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.lowerLimit" label="合法下限公式" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.explosivePopularity" label="爆红公式" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.unit" label="单位" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.xoc" label="xoc判断" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.sco" label="sco自动审核公式" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.defaultValue" label="默认值" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.enumType" label="枚举Type" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.instrumentTask" label="仪器任务" :isEdit="ctx.isEdit" />
			<MkInput v-model="formValue.remark" label="备注" :isEdit="ctx.isEdit" />
			<el-form-item label="是否启用">
				<el-switch v-model="formValue.isEnabled" size="large" active-text="启用" inactive-text="禁用" :isEdit="ctx.isEdit" />
			</el-form-item>
		</MkCardForm>
	</MkDrawer>
</template>
<script lang='ts' setup>
import { initialize } from './edit';
const formRef = ref({
	id: undefined,
	name: undefined,
	projectCode: undefined,
	textCode: undefined,
	referenceRange: undefined,
	upperLimit: undefined,
	lowerLimit: undefined,
	explosivePopularity: undefined,
	unit: undefined,
	xoc: undefined,
	sco: undefined,
	defaultValue: undefined,
	enumType: undefined,
	instrumentTask: undefined,
	remark: undefined,
	isEnabled: false,
});

const emits = defineEmits(['returnData']);
//修改后的数据
const displayData = () => {
	emits('returnData', formValue);
};

const { ctx, submitFn, openDrawerFn, closeDrawerFn, dataAssignment, mkDrawerRef, formValue, defaultValue } = initialize(formRef, displayData);

onMounted(() => {});

defineExpose({
	openDrawerFn,
	closeDrawerFn,
	dataAssignment,
	defaultValue,
});
</script>